const getters = {
  // 商品总数量
  totalNum(state) {
    let totalNum = 0
    state.cartList.forEach(v => {
      totalNum += v.count
    })
    return totalNum
  },
  // 计算商品总价
  totalPrice(state) {
    let totalPrice = 0
    state.cartList.forEach(v => {
      totalPrice += v.count * v.default_price
    })
    return totalPrice
  }
}

export default getters
